/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ADT;
import Interfaces.UniqueId;

/**
 *
 * @author markusbaisch
 */
public class UniqueIdImpl implements UniqueId{

    private final long number;

    // Konstruktor
    private UniqueIdImpl(long id) {
        number = id;
    }

    static UniqueId valueOf(long id) {
        return new UniqueIdImpl( id );
    }

    @Override
    public long idNumber() {
        return number;
    }

    @Override
    public boolean equals( Object o ) {
        if( o == this ) return true;
        if(!(o instanceof UniqueIdImpl)) return false;
        return number == ((UniqueIdImpl)o).idNumber();
    }

    @Override
    public int hashCode() {
        return (int) (3 * (number ^ (number >>> 32)));
    }
    
}
